<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>


</head>
<body>

<h3>新增合同定制模板</h3>
<form name="addContractForm" th:action="@{~/contract/addCustomContract}" method="post">
    标题：<input type="text" name="name"/><br/>
    类型：<select name="contractType">
    <option value="销售合同">销售合同</option>
    <option value="采购合同">采购合同</option>
    <option value="保密合同">保密合同</option>
    <!--其它合同类型-->
</select><br/>
    简介：<textarea name="contractRecord.remark" wrap="hard" rows="5" cols="20"></textarea><br/>
    <button onclick="">添加步骤(前端未实现)</button>
    <br/>
    内容1：<textarea name="contractSteps[0].contractItems[0].attributeValue" rows="15" cols="80"></textarea><br/>
    内容2：<textarea name="contractSteps[0].contractItems[1].attributeValue" rows="15" cols="80"></textarea><br/>
    <!--其它字段-->
    <!--其它字段-->

    <button type="submit">提交合同</button>
</form>


<h3>合同定制模板列表</h3>
<!--查询-->
<form name="searchContractForm" th:action="@{/contract/searchCustomContract}" method="post">
    标题：<input type="text" name="name"/><br/>
    类型：<select name="type">
    <option value=""></option>
    <option value="销售合同">销售合同</option>
    <option value="采购合同">采购合同</option>
    <option value="保密合同">保密合同</option>
    <!--其它合同类型-->
</select><br/>
    内容：<input type="text" name="text"/><br/>
    <button type="submit">查找合同</button>
</form>

<!--列表-->
<table border="1" cellspacing="0">
    <tr>
        <th>id</th>
        <th>标题</th>
        <th>类型</th>
        <th>编辑时间</th>
        <th>状态</th>
        <th>操作</th>
    </tr>
    <tr th:each="contract:${page.list}">
        <td th:text="${contract.id}">暂无</td>
        <td th:text="${contract.name}">暂无</td>
        <td th:text="${contract.contractType}">暂无</td>
        <td th:text="${contract.updateTime}">暂无</td>
        <td th:text="${contract.contractRecord}?((${contract.contractRecord.hasShare}=='是')?'启用':'禁用')">暂无</td>
        <td>
            <!--此链接不使用a标签则改为ajax请求--><a th:href="@{~/contract/showContract(id=${contract.id})}">详情</a>
            <a th:href="@{~/contract/editCustomContract(id=${contract.id})}">编辑</a>
            <a th:href="@{~/contract/switchShareStatus(id=${contract.id},path=${#request.getServletPath()})}"
               th:text="${contract.contractRecord}?((${contract.contractRecord.hasShare}=='是')?'禁用':'启用')">暂无</a>
            <a th:href="@{~/contract/deleteCustomContract(id=${contract.id})}">删除</a>
        </td>
    </tr>
</table>

<!--分页条-->
<div class="cp-item">
    <span>共</span>
    <span id="cp-count" th:text="${page.total}">0</span>
    <span>条</span>
</div>
<div class="cp-item">
    <span id="curr-page" th:text="${page.pageNum}">1</span>
    <span>/</span>
    <span id="total-page" th:text="${page.pages}">1</span>
</div>

<div th:if="${page.pages>0}">
    <a th:href="@{~/contract/customContractList(pageNum=1)}">首页</a></li>
    <a th:href="@{~/contract/customContractList(pageNum=${page.pageNum -1})}">上页</a></li>
    <form th:action="@{~/contract/customContractList}">
        <input name="pageNum" type="number"/>
        <button type="submit" id="goTo" class="btn btn-outline-primary">转到</button>
    </form>
    <a th:href="@{~/contract/customContractList(pageNum=${page.pageNum+1})}">下页</a></li>
    <a th:href="@{~/contract/customContractList(pageNum=${page.pages})}">尾页</a></li>
</div>

</form>
</body>
</html>